﻿

@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>新增记录-测试</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="~/layui/css/layui.css" media="all" />
</head>
<body>
    <div class="" style="padding-left:20px;">
        <fieldset class="layui-elem-field layui-field-title"  >
            <legend>测试新增</legend>
        </fieldset>
        <form class="layui-form layui-form-pane">
            <div class="layui-form-item">
           
                <div class="layui-block">            
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-block">
                        <input type="text" value=""   name="remark" lay-verify="required" class="layui-input">
                    </div>                </div>
            </div>
            <div class="layui-form-item">           
                <div class="layui-inline">            
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-inline">
                        <input type="text" value=""   name="sex" lay-verify="required" class="layui-input">
                    </div>                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="formData">保存</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
    
    <script type="text/javascript" src="~/layui/layui.js"></script>
    <script type="text/javascript" src="~/js/formRender.js"></script>
    <script>       
        var appUrl = '@Url.Action("")';
        var id = '@Request["id"]';
        layui.use(['form','laydate','jquery'], function () {
            var form = layui.form,
                laydate = layui.laydate;
            var $ = layui.$;
             
            //监听提交
            form.on('submit(formData)', function (data) {
                if (id) {
                    data.field.id = id;
                }
                $.ajax({
                    url: '@Url.Action("Save")',
                    data: fixData(data.field),
                    success: function (res) {

                        layer.msg('保存成功！');
                    }
                })
                return false;
            });

            if ('@ViewBag.Mode' == 'edit') {
                renderEdit($,form);   
                
            }
        })
    </script>
</body>
</html>

 